﻿<UserControl x:Name="_root"
	x:Class="WPFCABShell.$safeprojectname$.Options.Plugins.PluginsView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:con="http://schemas.kent.boogaart.com/converters"
	xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
	xmlns:sys="clr-namespace:System;assembly=mscorlib">
	<Grid DataContext="{Binding ElementName=_root}">
		<Grid.Resources>
			<CollectionViewSource x:Key="Plugins" Source="{Binding PluginInfos}">
				<CollectionViewSource.GroupDescriptions>
					<PropertyGroupDescription PropertyName="IsImplicitlyTrusted"/>
				</CollectionViewSource.GroupDescriptions>
				<CollectionViewSource.SortDescriptions>
					<scm:SortDescription PropertyName="IsImplicitlyTrusted" Direction="Descending"/>
					<scm:SortDescription PropertyName="Name"/>
				</CollectionViewSource.SortDescriptions>
			</CollectionViewSource>
		</Grid.Resources>
		
		<ScrollViewer>
			<ItemsControl ItemsSource="{Binding Source={StaticResource Plugins}}" Style="{DynamicResource PluginsItemsControlStyle}">
				<!-- GroupStyle has to be set here - cannot be set via style -->
				<ItemsControl.GroupStyle>
					<GroupStyle>
						<GroupStyle.HeaderTemplate>
							<DataTemplate>
								<ContentControl Content="{DynamicResource PluginsItemsControlHeaderContent}"/>
							</DataTemplate>
						</GroupStyle.HeaderTemplate>
					</GroupStyle>
				</ItemsControl.GroupStyle>
			</ItemsControl>
		</ScrollViewer>
	</Grid>
</UserControl>
